<include file="__THEME__/public_header" />
<link href="__APP__/account.css" rel="stylesheet" type="text/css" />

<div id="page-wrap">
  <div id="main-wrap">
    <div id="col" class="st-grid content-bg boxShadow">
      <div id="col4" class="main-left">
        <!--tab菜单-->
        <include file="_tabs" />
      </div>
      <div id="col7" class="main-right">
        <div class="extend minh person-set">
          <div class="set-hd"><h3>{$tabName}</h3></div>
          <div class="set-item-title f9"><font color="red"> * </font>为必填项，请放心填写，您的隐私信息将会得到保护。</div>
          <div class="set-item-info">
            <form action="{:U('public/Account/doAuthenticate')}" method="post" model-node='verify_apply'>
              <input type="hidden" name="vtype" value="{$verifyInfo['usergroup_id']}" id="vtype">
              <dl class="form-set form-contact">
                <dd><div class="form-tt">当前状态：</div><div class="form-row">{$status}</div></dd>
                <php>if($edit == 1 || !$verifyInfo){</php>
                <dd>
                  <div class="form-tt"><font color="red"> * </font>认证类型：</div>
                  <div class="form-row">
                  <volist name='auType' id='vo'>
                  <label><input class="s-ck" type="radio" value="{$vo.user_group_id}"<php>if(($verifyInfo['usergroup_id']=="" &&  $vo['user_group_id']==5) || $vo['user_group_id']==$verifyInfo['usergroup_id']){</php>checked="checked"<php>}</php> name="usergroup_id" onclick='changeText({$vo.user_group_id})'>{$vo.user_group_name}</label>
                  </volist>
                  </div>
                </dd>
                <dd id="vCate" style="display:none;">
                  <div class="form-tt">认证分类：</div>
                  <div class="form-row">
                    <select name="verifiedCategory" id="verifiedCategory">
                      {$option[5]}
                      <!-- <volist name="category" id="vo">
                      <option value="{$vo.user_verified_category_id}" <php>if($vo['user_verified_category_id'] == $verifyInfo['verified_category_id']) echo "selected";</php>>{$vo.title}</option>
                      </volist> -->
                    </select>
                  </div>
                </dd>
                <dd style="<php>if($verifyInfo['usergroup_id'] <> 6){</php>display:none;<php>}</php>" id="company2">
                  <div class="form-tt"><font color="red"> * </font>企业名称：</div>
                  <div class="form-row"><input name="company" class="s-txt" id="company" value="{$verifyInfo['company']}"/></div>
                </dd>
                <dd>
                  <div class="form-tt" id="realname2"><font color="red"> * </font><php>if($verifyInfo['usergroup_id'] == 6){</php>法人姓名：<php>}else{</php>真实姓名：<php>}</php></div>
                  <div class="form-row"><input name="realname" class="s-txt" id="realname" <php>if($verifyInfo['verified'] !== ""){</php>value="{$verifyInfo['realname']}"<php>}</php> /></div>
                </dd>
                <dd>
                  <div class="form-tt" id="idcard2"><font color="red"> * </font><php>if($verifyInfo['usergroup_id'] == 6){</php>营业执照号：<php>}else{</php>身份证号码：<php>}</php></div>
                  <div class="form-row"><input name="idcard" class="s-txt" id="idcard" <php>if($verifyInfo['verified'] !== ""){</php>value="{$verifyInfo['idcard']}"<php>}</php> /></div>
                </dd>
                <dd>
                  <div class="form-tt" id="phone2"><font color="red"> * </font><php>if($verifyInfo['usergroup_id'] == 6){</php>联系方式：<php>}else{</php>手机号码：<php>}</php></div>
                  <div class="form-row"><input name="phone" class="s-txt" id="phone" <php>if($verifyInfo['verified'] !== ""){</php>value="{$verifyInfo['phone']}"<php>}</php> /></div>
                </dd>
                <php>if($verifyInfo['usergroup_id'] != 6):</php>
                
                <dd>
                  <div class="form-tt" id="school2"><font color="red"> * </font>学校</div>
                  <div class="form-row"><input name="school" class="s-txt" id="school" <php>if($verifyInfo['verified'] !== ""){</php>value="{$verifyInfo['school']}"<php>}</php> /></div>
                </dd>
                <dd>
                  <div class="form-tt" id="specialty2"><font color="red"> * </font>专业</div>
                  <div class="form-row"><input name="specialty" class="s-txt" id="specialty" <php>if($verifyInfo['verified'] !== ""){</php>value="{$verifyInfo['specialty']}"<php>}</php> /></div>
                </dd>
                <dd>
                  <div class="form-tt" id="address2">个人地址</div>
                  <div class="form-row"><input name="address" class="s-txt" id="address" <php>if($verifyInfo['verified'] !== ""){</php>value="{$verifyInfo['address']}"<php>}</php> /></div>
                </dd>
                <dd>
                  <div class="form-tt" id="s_address2">学校地址</div>
                  <div class="form-row"><input name="s_address" class="s-txt" id="s_address" <php>if($verifyInfo['verified'] !== ""){</php>value="{$verifyInfo['s_address']}"<php>}</php> /></div>
                </dd>
                
                <php>endif;</php>
                <dd>
                  <div class="form-tt"><font color="red"> * </font>认证理由：</div>
                  <div class="form-row"><textarea rows="4" cols="73" name="reason" id="reason" class="s-textarea"><php>if($verifyInfo['verified'] !== ""){</php>{$verifyInfo['reason']|format}<php>}</php></textarea></div>
                </dd>
                                        <!-- <dd><div class="form-tt"><font color="red"> * </font>认证资料：</div><div class="form-row"><textarea rows="4" cols="73" name="info" id="info" class="s-textarea"><php>if($verifyInfo['verified'] !== ""){</php>{$verifyInfo['info']}<php>}</php></textarea></div></dd> -->
                <dd>
                  <div class="form-tt">认证附件：</div>
                  <div class="form-row second_input" >{:W('Upload',array('attachIds'=>$verifyInfo['attachIds'], 'uploadType'=>'image', 'urlquery'=>'attach_type=feed_image&upload_type=image&thumb=1'))}<div style="padding:5px 0;"><!--附件大小：不超过{$attachOption.attach_max_size}M--></div></div>
                </dd>
                <dd>
                  <div class="form-tt">其他资料：</div>
                  <div class="form-row second_input">{:W('Upload',array('inputname'=>'other_data','attachIds'=>$verifyInfo['other_data_ids'], 'uploadType'=>'file', 'urlquery'=>'attach_type=feed_image&upload_type=file'))}<div style="padding:5px 0;"></div></div>
                </dd>
                <script type="text/javascript">
                  $('.second_input input:file').click(function(){
                    $('.second_input input:file').val('');
                  })
                </script>
                <dd>
                  <div class="form-tt"></div>
                  <div class="form-row">
                    <!-- <a event-node="submit_btn" href="javascript:void(0);" class="btn-green-big"><span>提交</span></a> -->
                    <a onclick="saveVerify();" href="javascript:void(0);" class="btn-green-big">提交</a>
                  </div>
                </dd>
                <php>}else{</php>
                <dd>
                  <div class="form-tt"><font color="red"> * </font>认证类型：</div>
                  <div class="form-row">
                  <volist name='auType' id='vo'>
                  <php>if($vo['user_group_id']==$verifyInfo['usergroup_id']){</php><label>{$vo.user_group_name}</label><php>}</php>
                  </volist>
                  </div>
                </dd>
                <php>if($verifyInfo['category']['title']){</php>
                <dd>
                  <div class="form-tt">认证分类：</div>
                  <div class="form-row">{$verifyInfo['category']['title']}</div>
                </dd>
                <php>}</php>
                <dd style="<php>if($verifyInfo['usergroup_id'] <> 6){</php>display:none;<php>}</php>" id="company2">
                  <div class="form-tt"><font color="red"> * </font>企业名称：</div>
                  <div class="form-row">{$verifyInfo['company']}</div>
                </dd>
                <dd>
                  <div class="form-tt" id="realname2"><font color="red"> * </font><php>if($verifyInfo['usergroup_id'] == 6){</php>法人姓名：<php>}else{</php>真实姓名：<php>}</php></div>
                  <div class="form-row">{$verifyInfo['realname']}</div>
                </dd>
                <dd>
                  <div class="form-tt" id="idcard2"><font color="red"> * </font><php>if($verifyInfo['usergroup_id'] == 6){</php>营业执照号：<php>}else{</php>身份证号码：<php>}</php></div>
                  <div class="form-row">{$verifyInfo['idcard']}</div>
                </dd>
                <dd>
                  <div class="form-tt" id="phone2"><font color="red"> * </font><php>if($verifyInfo['usergroup_id'] == 6){</php>联系方式：<php>}else{</php>手机号码：<php>}</php></div>
                  <div class="form-row">{$verifyInfo['phone']}</div>
                </dd>
                <php>if($verifyInfo['usergroup_id'] != 6):</php>
                
                <dd>
                  <div class="form-tt" id="school2"><font color="red"> * </font>学校</div>
                  <div class="form-row">{$verifyInfo['school']}</div>
                </dd>
                <dd>
                  <div class="form-tt" id="specialty2"><font color="red"> * </font>专业</div>
                  <div class="form-row">{$verifyInfo['specialty']}</div>
                </dd>
                <dd>
                  <div class="form-tt" id="address2">个人地址</div>
                  <div class="form-row">{$verifyInfo['address']}</div>
                </dd>
                <dd>
                  <div class="form-tt" id="s_address2">学校地址</div>
                  <div class="form-row">{$verifyInfo['s_address']}</div>
                </dd>
                
                <php>endif;</php>
                <dd>
                  <div class="form-tt"><font color="red"> * </font>认证理由：</div>
                  <div class="form-row">{$verifyInfo['reason']|format}</div>
                </dd>
                <!-- <dd><div class="form-tt"><font color="red"> * </font>认证资料：</div><div class="form-row">{$verifyInfo['info']}</div></dd> -->
                <dd>
                  <div class="form-tt">认证附件：</div>
                  <div class="form-row"><php>if($verifyInfo['attachment']){</php>{$verifyInfo['attachment']}<php>}else{</php>无<php>}</php></div>
                </dd>
                <dd>
                  <div class="form-tt">其他资料：</div>
                  <div class="form-row"><php>if($verifyInfo['other_data_list']){</php>{$verifyInfo['other_data_list']}<php>}else{</php>无<php>}</php></div>
                </dd>
                <php>}</php>
              </dl>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

<script src="__THEME__/js/module.form.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function(){
      var user_group_id = $(":radio[name='usergroup_id']:checked").attr('value');
      var cate = <?php echo $option;?>;
      if(cate[user_group_id]){
        $('#vCate').css('display','block');
        $('#verifiedCategory').html(cate[user_group_id]);
      }
    });
    var changeText = function(user_group_id){
        if(user_group_id == 6){
            $('#company2').css('display','');
            $('#realname2').html('<font color="red"> * </font>法人姓名：');
            $('#idcard2').html('<font color="red"> * </font>营业执照号：');
            $('#phone2').html('<font color="red"> * </font>联系方式：');   
        }else{
            $('#company2').css('display','none');
            $('#realname2').html('<font color="red"> * </font>真实姓名：');
            $('#idcard2').html('<font color="red"> * </font>身份证号码：');
            $('#phone2').html('<font color="red"> * </font>手机号码：');
        }
        $('#vtype').val(user_group_id);
        var cate = <?php echo $option;?>;
        if(cate[user_group_id]){
          $('#vCate').css('display','block');
          $('#verifiedCategory').html(cate[user_group_id]);
        }else{
          $('#vCate').css('display','none');
        }
    };
    
    var delverify = function(){
        if(confirm('确定要注销认证吗？')){
            $.post(U('public/Account/delverify'),{},function(txt){
                if(txt == 1){
                    ui.success('注销成功');
                    setTimeout("location.reload()",'3000');
                }else{
                    ui.error('注销失败');
                }
            });
        }
    };

    var saveVerify = function(){
      var vtype = $('#vtype').val();
      var company = $('#company').val();
      var realname = $('#realname').val();
      var idcard = $('#idcard').val();
      var phone = $('#phone').val();
      var reason = $('#reason').val();
      var verifiedCategory = $('#verifiedCategory').val();
      var attach_ids = $('#attach_ids').val();
      var school = $('#school').val();
      var specialty = $('#specialty').val();
      var address = $('#address').val();
      var s_address = $('#s_address').val();
      var other_data_ids = $('#other_data_ids').val();
      $.post(U('public/Account/doAuthenticate'),{usergroup_id:vtype,company:company,realname:realname,idcard:idcard,phone:phone,reason:reason,verifiedCategory:verifiedCategory,attach_ids:attach_ids,other_data_ids:other_data_ids,s_address:s_address,address:address,specialty:specialty,school:school},function(msg){
          if(msg == 1){
            ui.success('申请成功，请等待审核');
            setTimeout("location.reload()",'3000');
          }else{
            ui.error(msg);
          }
      });
    }
</script>
<include file="__THEME__/public_footer" />
